{template '_header'}

<div class="page-heading"> 
	
	<span class='pull-right'>
		
		{ifp 'shop.verify.store.add'}
                            <a class="btn btn-primary btn-sm" href="{php echo merchUrl('shop/verify/store/add')}">添加新门店</a>
		{/if}
                
		<a class="btn btn-default  btn-sm" href="{php echo merchUrl('shop/verify/store')}">返回列表</a>
                
                
	</span>
	<h2>{if !empty($item['id'])}编辑{else}添加{/if}门店 <small>{if !empty($item['id'])}修改【{$item['storename']}】{/if}</small></h2> 
</div>
 
    <form {ife 'shop.verify.store' $item}action="" method="post"{/if} class="form-horizontal form-validate" enctype="multipart/form-data">
        <input type="hidden" name="id" value="{$item['id']}" />
    
                <div class="form-group">
                    <label class="col-sm-2 control-label must">门店名称</label>
                    <div class="col-sm-9 col-xs-12">
                        {ife 'shop.verify.store' $item}
                        <input type="text" name="storename" class="form-control" value="{$item['storename']}" data-rule-required="true" />
                        {else}
                        <div class='form-control-static'>{$item['storename']}</div>
                        {/if}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">门店LOGO</label>
                    <div class="col-sm-9 col-xs-12">
                          {ife 'shop.verify.store' $item}
                               {php echo tpl_form_field_image('logo',$item['logo'],'',array('dest_dir'=>'merch/'.$_W['merchid']))}
                               {else}
                        {if !empty($item['logo'])}
	                        <a href='{php echo tomedia($item['logo'])}' target='_blank'>
	                           <img src="{php echo tomedia($item['logo'])}" style='width:100px;border:1px solid #ccc;padding:1px' />
	                        </a>
                        {/if}
			{/if}
                    </div>
                </div>
	
               <div class="form-group">
                    <label class="col-sm-2 control-label">门店地址</label>
                    <div class="col-sm-9 col-xs-12">
                            {ife 'shop.verify.store' $item}
                        <input type="text" name="address" class="form-control" value="{$item['address']}" />
                               {else}
                        <div class='form-control-static'>{$item['address']}</div>
                        {/if}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">门店电话</label>
                    <div class="col-sm-9 col-xs-12">
                               {ife 'shop.verify.store' $item}
                        <input type="text" name="tel" class="form-control" value="{$item['tel']}" />
                               {else}
                        <div class='form-control-static'>{$item['tel']}</div>
                        {/if}
                    </div>
                </div>
	 <div class="form-group">
                    <label class="col-sm-2 control-label">营业时间</label>
                    <div class="col-sm-9 col-xs-12">
                            {ife 'shop.verify.store' $item}
                        <input type="text" name="saletime" class="form-control" value="{$item['saletime']}" />
                               {else}
                        <div class='form-control-static'>{$item['saletime']}</div>
                        {/if}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">门店位置</label>
                    <div class="col-sm-9 col-xs-12">
                               {ife 'shop.verify.store' $item}
                        {php echo tpl_form_field_coordinate('map',array('lng'=>$item['lng'],'lat'=>$item['lat']))}
                               {else}
                        <div class='form-control-static'>lng={$item['lng']},lat={$item['lat']}</div>
                        {/if}
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">门店支持</label>
                    <div class="col-sm-9 col-xs-12">
                        {ife 'shop.verify.store' $item}
                        <label class='radio-inline'>
                            <input type='radio' name='type' value='1' {if $item['type']==1}checked{/if} /> 支持自提
                        </label>

                        <label class='radio-inline'>
                            <input type='radio' name='type' value='2' {if $item['type']==2}checked{/if} /> 支持核销
                        </label>

                        <label class='radio-inline'>
                            <input type='radio' name='type' value='3' {if $item['type']==3}checked{/if} /> 支持自提+核销
                        </label>
                        {else}
                        <div class='form-control-static'>{if $item['type']==1}支持自提{else if $item['type']==2}支持核销{else if $item['type']==3}支持自提+核销{/if}</div>
                        {/if}
                    </div>
                </div>

                <div class="form-group" id="pick_info" {if empty($item['type']) || $item['type']==2}style="display:none;"{/if}>
                    <label class="col-sm-2 control-label">自提信息</label>
                    <div class="col-sm-10 col-xs-12">
                        {ife 'shop.verify.store' $item}


                        <label class="radio-inline" style="float: left;padding-left:0px;">联系人</label>

                        <div class="col-sm-9 col-xs-12" style="width: 120px; float: left; margin: 0px 20px 0px -5px;">
                            <input type="text" value="{$item['realname']}" class="form-control" name="realname" style="width:120px;padding:5px;">
                        </div>

                        <label class="radio-inline" style="float: left;">联系电话</label>
                        <div class="col-sm-9 col-xs-12" style="width: 120px; float: left; margin: 0px 20px 0px -5px;">
                            <input type="text" value="{$item['mobile']}" class="form-control" name="mobile" style="width:120px;padding:5px;">
                        </div>
						
		    <label class="radio-inline" style="float: left;">自提时间</label>
                        <div class="col-sm-9 col-xs-12" style="width: 200px; float: left; margin: 0px 0px 0px -5px;">
                            <input type="text" value="{$item['fetchtime']}" class="form-control" name="fetchtime" style="width:200px;padding:5px;">
                        </div>

                        {else}
                        <div class='form-control-static'>联系人:{$item['realname']} 联系电话:{$item['mobile']}</div>
                        {/if}
                    </div>
                </div>


               <div class="form-group">
                    <label class="col-sm-2 control-label">门店简介</label>
                    <div class="col-sm-9 col-xs-12">
                            {ife 'shop.verify.store' $item}
                         <textarea name="desc" class="form-control richtext" cols="70">{$item['desc']}</textarea>
                               {else}
                        <div class='form-control-static'>{$item['desc']}</div>
                        {/if}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">状态</label>
                    <div class="col-sm-9 col-xs-12">
                               {ife 'shop.verify.store' $item}
                        <label class='radio-inline'>
                            <input type='radio' name='status' value=1' {if $item['status']==1}checked{/if} /> 启用
                        </label>
                        <label class='radio-inline'>
                            <input type='radio' name='status' value=0' {if $item['status']==0}checked{/if} /> 禁用
                        </label>
                               {else}
                        <div class='form-control-static'>{if $item['status']==1}启用{else}禁用{/if}</div>
                        {/if}
                    </div>
                </div>
                
                      <div class="form-group"></div>
            <div class="form-group">
                    <label class="col-sm-2 control-label"></label>
                    <div class="col-sm-9 col-xs-12">
                           {ife 'shop.verify.store' $item}
                            <input type="submit" value="提交" class="btn btn-primary"  />
                            
                        {/if}
                       <input type="button" name="back" onclick='history.back()' {ifp 'shop.verify.store.add|shop.verify.store.edit'}style='margin-left:10px;'{/if} value="返回列表" class="btn btn-default" />
                    </div>
            </div>
 </form>
<script language='javascript'>
    $(function () {
        $(':radio[name=type]').click(function () {
            type = $("input[name='type']:checked").val();

            if(type=='1' || type=='3'){
                $('#pick_info').show();
            } else {
                $('#pick_info').hide();
            }
        })
    })
    </script>
{template '_footer'}